package com.xinhe.web.reposity;

import com.xinhe.web.entity.Identity;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Query;

public interface IdentityRepository  extends JpaRepository<Identity, Long> {
    @Query(value = "select * from tb_identity where removed = 0 and f_user_id = ?1 and check_status <> 'FAILURE'",nativeQuery = true)
    Identity findByUserId(Long userId);
    @Query(value = "select count(1) from tb_identity where removed=0 and card=?1 and check_status='SUCCESS'",nativeQuery = true)
    Integer findByCode(String card);
}
